package log

import (
	"fmt"
)

var logger *Logger
type Log func(format string, v ...interface{}) error


var Debug Log
var Error Log
var Fatal Log
var Info Log
var Trace Log

func UndoInit(){
}

func Open(){
	logger.Open()
}

func Close(){
	logger.Close()
}

func Init(path string) error {
	logger, err := NewLogger(path,"gonnectd","GONNECTD", DEBUG)
	if err != nil {
		fmt.Println("Init log error")
		return err
	}
	Debug = logger.Debug
	Error = logger.Error
	Fatal = logger.Fatal
	Info  = logger.Info
	Trace = logger.Trace

	return nil
}
